using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using Common;
using ComponentFactory.Krypton.Toolkit;
using DukeyCssFetch.api;
using DukeyCssFetch.api.mou18.com;
using DukeyCssFetch.auth.mou18.com;
using DukeyCssFetch.Properties;

namespace DukeyCssFetch
{
	// Token: 0x0200002D RID: 45
	public class FetchTempletsFrm : KryptonForm
	{
		// Token: 0x060001AC RID: 428 RVA: 0x00011A74 File Offset: 0x0000FC74
		public FetchTempletsFrm()
		{
			this.string_0 = string.Empty;
			this.dictionary_0 = new Dictionary<string, string>();
			
			this.InitializeComponent();
			this.kryptonManager_0.GlobalPaletteMode = Comm.skin;
			Control.CheckForIllegalCrossThreadCalls = false;
			this.cbbianma.SelectedIndex = 0;
			dukeyauth dukeyauth = new dukeyauth();
			string regkey = Settings.Default.regkey;
			string sHA1MachineCode = WMICardGrab.GetSHA1MachineCode();
			string text = Settings.Default.email;
			text = text.Replace(".", "-");
			dukeyauth.AuthUser(text, sHA1MachineCode, regkey, "f897ed3a-fb14-4ad1-80a2-b69973743230", ref this.string_0, 300);
			if (this.string_0 == "ok")
			{
				this.btnALLDownload.Enabled = false;
				this.btnALLDownload.Dispose();
				return;
			}
			this.btnALLDownload.Enabled = true;
		}

		// Token: 0x060001B1 RID: 433 RVA: 0x00011DF4 File Offset: 0x0000FFF4
		private void btnALLDownload_Click(object sender, EventArgs e)
		{
			this.thread_1 = new Thread(new ThreadStart(this.method_8));
			this.thread_1.Start();
		}

		// Token: 0x060001AE RID: 430 RVA: 0x00011C18 File Offset: 0x0000FE18
		private void btnAnalysis_Click(object sender, EventArgs e)
		{
			this.thread_0 = new Thread(new ThreadStart(this.method_2));
			this.thread_0.Start();
		}

		// Token: 0x060001AD RID: 429 RVA: 0x00011B50 File Offset: 0x0000FD50
		private void btnLoadTxt_Click(object sender, EventArgs e)
		{
			using (OpenFileDialog openFileDialog = new OpenFileDialog())
			{
				openFileDialog.RestoreDirectory = true;
				if (!Directory.Exists(Comm.root + "templets"))
				{
					Directory.CreateDirectory(Comm.root + "templets");
				}
				openFileDialog.InitialDirectory = Comm.root + "templets";
				openFileDialog.Filter = "文本文件|*.txt";
				openFileDialog.FilterIndex = 0;
				if (DialogResult.OK == openFileDialog.ShowDialog() && openFileDialog.FileName != "")
				{
					System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("gb2312");
					this.txtCustomFileList.Text = FileHelper.ReadFile(openFileDialog.FileName, encoding);
				}
			}
		}

		// Token: 0x060001B9 RID: 441 RVA: 0x00012F64 File Offset: 0x00011164
		private void btnReplaceWord_Click(object sender, EventArgs e)
		{
			FetchReplaceFrm fetchReplaceFrm = new FetchReplaceFrm();
			fetchReplaceFrm.ShowDialog();
		}

		// Token: 0x060001B0 RID: 432 RVA: 0x00011D9C File Offset: 0x0000FF9C
		public void DelegateMethod(ListView gvfiles, string name, string templets_path, string orginurl)
		{
			ListViewItem listViewItem = new ListViewItem((gvfiles.Items.Count + 1).ToString());
			listViewItem.Tag = orginurl;
			listViewItem.ToolTipText = templets_path + name;
			listViewItem.SubItems.Add(name);
			gvfiles.Items.Add(listViewItem);
		}

		// Token: 0x060001BC RID: 444 RVA: 0x00012FC0 File Offset: 0x000111C0
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x060001BD RID: 445 RVA: 0x00012FE0 File Offset: 0x000111E0
		private void InitializeComponent()
		{
			this.icontainer_0 = new Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(FetchTempletsFrm));
			this.kryptonContextMenuItem_0 = new KryptonContextMenuItem();
			this.kryptonContextMenuItems_0 = new KryptonContextMenuItems();
			this.kryptonContextMenuItems_1 = new KryptonContextMenuItems();
			this.linkLabel1 = new LinkLabel();
			this.label5 = new Label();
			this.lblTip = new Label();
			this.label3 = new Label();
			this.txtdir = new KryptonTextBox();
			this.groupBox2 = new GroupBox();
			this.btnLoadTxt = new KryptonButton();
			this.btnAnalysis = new KryptonButton();
			this.btnReplaceWord = new KryptonButton();
			this.btnALLDownload = new KryptonButton();
			this.txtCustomFileList = new TextBox();
			this.btnBrowser = new KryptonButton();
			this.label2 = new Label();
			this.label1 = new Label();
			this.label4 = new Label();
			this.txtdomain = new KryptonTextBox();
			this.txtFolder = new KryptonTextBox();
			this.txtSkinTag = new KryptonTextBox();
			this.groupBox3 = new GroupBox();
			this.gvFiles = new ListView();
			this.columnHeader_0 = new ColumnHeader();
			this.columnHeader_1 = new ColumnHeader();
			this.gvrmenu = new ContextMenuStrip(this.icontainer_0);
			this.编辑ToolStripMenuItem = new ToolStripMenuItem();
			this.打开文件ToolStripMenuItem = new ToolStripMenuItem();
			this.在浏览器中查看ToolStripMenuItem = new ToolStripMenuItem();
			this.浏览网页本地ToolStripMenuItem = new ToolStripMenuItem();
			this.复制地址ToolStripMenuItem = new ToolStripMenuItem();
			this.toolStripMenuItem1 = new ToolStripMenuItem();
			this.从列表中移除ToolStripMenuItem = new ToolStripMenuItem();
			this.彻底删除文件ToolStripMenuItem = new ToolStripMenuItem();
			this.buttonSpecAny_0 = new ButtonSpecAny();
			this.kryptonContextMenu_0 = new KryptonContextMenu();
			this.kryptonContextMenuHeading_0 = new KryptonContextMenuHeading();
			this.kryptonContextMenuSeparator_0 = new KryptonContextMenuSeparator();
			this.kryptonContextMenuItems_2 = new KryptonContextMenuItems();
			this.kryptonContextMenuItem_1 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_2 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_3 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_4 = new KryptonContextMenuItem();
			this.kryptonContextMenuItems_3 = new KryptonContextMenuItems();
			this.oYdpSsUdEq = new KryptonContextMenuItems();
			this.kryptonContextMenuItem_5 = new KryptonContextMenuItem();
			this.kryptonContextMenuItems_4 = new KryptonContextMenuItems();
			this.kryptonManager_0 = new KryptonManager(this.icontainer_0);
			this.cbbianma = new ComboBox();
			this.txtDelay = new KryptonTextBox();
			this.label6 = new Label();
			this.linkLabel2 = new LinkLabel();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.gvrmenu.SuspendLayout();
			base.SuspendLayout();
			this.kryptonContextMenuItem_0.Text = "Menu Item";
			this.linkLabel1.AutoSize = true;
			this.linkLabel1.Location = new Point(377, 95);
			this.linkLabel1.Name = "linkLabel1";
			this.linkLabel1.Size = new Size(53, 12);
			this.linkLabel1.TabIndex = 27;
			this.linkLabel1.TabStop = true;
			this.linkLabel1.Text = "打开目录";
			this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
			this.label5.AutoSize = true;
			this.label5.Location = new Point(7, 95);
			this.label5.Name = "label5";
			this.label5.Size = new Size(47, 12);
			this.label5.TabIndex = 25;
			this.label5.Text = "保存到:";
			this.lblTip.AutoSize = true;
			this.lblTip.ForeColor = Color.Red;
			this.lblTip.Location = new Point(3, 331);
			this.lblTip.Name = "lblTip";
			this.lblTip.Size = new Size(143, 12);
			this.lblTip.TabIndex = 23;
			this.lblTip.Text = "欢迎你使用都客仿站高手!";
			this.label3.AutoSize = true;
			this.label3.Location = new Point(5, 57);
			this.label3.Name = "label3";
			this.label3.Size = new Size(59, 12);
			this.label3.TabIndex = 22;
			this.label3.Text = "模板位置:";
			this.txtdir.Location = new Point(68, 52);
			this.txtdir.Name = "txtdir";
			this.txtdir.Size = new Size(139, 20);
			this.txtdir.TabIndex = 28;
			this.txtdir.WordWrap = false;
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.cbbianma);
			this.groupBox2.Controls.Add(this.btnLoadTxt);
			this.groupBox2.Controls.Add(this.btnAnalysis);
			this.groupBox2.Controls.Add(this.btnReplaceWord);
			this.groupBox2.Controls.Add(this.btnALLDownload);
			this.groupBox2.Controls.Add(this.txtCustomFileList);
			this.groupBox2.Controls.Add(this.btnBrowser);
			this.groupBox2.Controls.Add(this.label2);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label1);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.linkLabel1);
			this.groupBox2.Controls.Add(this.txtdomain);
			this.groupBox2.Controls.Add(this.txtFolder);
			this.groupBox2.Controls.Add(this.txtSkinTag);
			this.groupBox2.Controls.Add(this.txtDelay);
			this.groupBox2.Controls.Add(this.txtdir);
			this.groupBox2.Location = new Point(5, 12);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new Size(452, 305);
			this.groupBox2.TabIndex = 29;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "下载网页";
			this.btnLoadTxt.AutoSize = true;
			this.btnLoadTxt.Location = new Point(322, 147);
			this.btnLoadTxt.Name = "btnLoadTxt";
			this.btnLoadTxt.Size = new Size(90, 25);
			this.btnLoadTxt.TabIndex = 40;
			this.btnLoadTxt.Values.Text = "加载文件";
			this.btnLoadTxt.Click += new EventHandler(this.btnLoadTxt_Click);
			this.btnAnalysis.AutoSize = true;
			this.btnAnalysis.Location = new Point(322, 21);
			this.btnAnalysis.Name = "btnAnalysis";
			this.btnAnalysis.Size = new Size(90, 25);
			this.btnAnalysis.TabIndex = 39;
			this.btnAnalysis.Values.Text = "分析";
			this.btnAnalysis.Click += new EventHandler(this.btnAnalysis_Click);
			this.btnReplaceWord.AutoSize = true;
			this.btnReplaceWord.Location = new Point(322, 187);
			this.btnReplaceWord.Name = "btnReplaceWord";
			this.btnReplaceWord.Size = new Size(90, 25);
			this.btnReplaceWord.TabIndex = 38;
			this.btnReplaceWord.Values.Text = "替换词组";
			this.btnReplaceWord.Click += new EventHandler(this.btnReplaceWord_Click);
			this.btnALLDownload.AutoSize = true;
			this.btnALLDownload.Location = new Point(322, 260);
			this.btnALLDownload.Name = "btnALLDownload";
			this.btnALLDownload.Size = new Size(90, 25);
			this.btnALLDownload.TabIndex = 31;
			this.btnALLDownload.Values.Text = "一键下载";
			this.btnALLDownload.Click += new EventHandler(this.btnALLDownload_Click);
			this.txtCustomFileList.Location = new Point(60, 147);
			this.txtCustomFileList.Multiline = true;
			this.txtCustomFileList.Name = "txtCustomFileList";
			this.txtCustomFileList.Size = new Size(256, 138);
			this.txtCustomFileList.TabIndex = 36;
			this.btnBrowser.AutoSize = true;
			this.btnBrowser.Location = new Point(281, 88);
			this.btnBrowser.Name = "btnBrowser";
			this.btnBrowser.Size = new Size(90, 25);
			this.btnBrowser.TabIndex = 35;
			this.btnBrowser.Values.Text = "浏览文件夹";
			this.label2.AutoSize = true;
			this.label2.Location = new Point(58, 127);
			this.label2.Name = "label2";
			this.label2.Size = new Size(149, 12);
			this.label2.TabIndex = 25;
			this.label2.Text = "自定义下载文件(一行一个)";
			this.label1.AutoSize = true;
			this.label1.Location = new Point(6, 29);
			this.label1.Name = "label1";
			this.label1.Size = new Size(59, 12);
			this.label1.TabIndex = 22;
			this.label1.Text = "输入域名:";
			this.label4.AutoSize = true;
			this.label4.Location = new Point(209, 57);
			this.label4.Name = "label4";
			this.label4.Size = new Size(53, 12);
			this.label4.TabIndex = 22;
			this.label4.Text = "模板标签";
			this.txtdomain.Location = new Point(68, 25);
			this.txtdomain.Name = "txtdomain";
			this.txtdomain.Size = new Size(248, 20);
			this.txtdomain.TabIndex = 28;
			this.txtdomain.Text = "http://";
			this.txtdomain.WordWrap = false;
			this.txtFolder.Location = new Point(70, 91);
			this.txtFolder.Name = "txtFolder";
			this.txtFolder.Size = new Size(205, 20);
			this.txtFolder.TabIndex = 28;
			this.txtFolder.Text = "D:\\模板提取";
			this.txtFolder.WordWrap = false;
			this.txtSkinTag.Location = new Point(264, 52);
			this.txtSkinTag.Name = "txtSkinTag";
			this.txtSkinTag.Size = new Size(177, 20);
			this.txtSkinTag.TabIndex = 28;
			this.txtSkinTag.Text = "{dede:global.cfg_templets_skin/}";
			this.txtSkinTag.WordWrap = false;
			this.groupBox3.Controls.Add(this.gvFiles);
			this.groupBox3.Location = new Point(461, 12);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new Size(216, 305);
			this.groupBox3.TabIndex = 30;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "模板列表";
			this.gvFiles.BorderStyle = BorderStyle.FixedSingle;
			this.gvFiles.Columns.AddRange(new ColumnHeader[]
			{
				this.columnHeader_0,
				this.columnHeader_1
			});
			this.gvFiles.ContextMenuStrip = this.gvrmenu;
			this.gvFiles.Dock = DockStyle.Fill;
			this.gvFiles.FullRowSelect = true;
			this.gvFiles.Location = new Point(3, 17);
			this.gvFiles.Name = "gvFiles";
			this.gvFiles.Size = new Size(210, 285);
			this.gvFiles.TabIndex = 1;
			this.gvFiles.UseCompatibleStateImageBehavior = false;
			this.gvFiles.View = View.Details;
			this.columnHeader_0.Text = "序号";
			this.columnHeader_0.Width = 40;
			this.columnHeader_1.Text = "文件名";
			this.columnHeader_1.Width = 167;
			this.gvrmenu.Font = new Font("Segoe UI", 9f);
			this.gvrmenu.Items.AddRange(new ToolStripItem[]
			{
				this.编辑ToolStripMenuItem,
				this.打开文件ToolStripMenuItem,
				this.在浏览器中查看ToolStripMenuItem,
				this.浏览网页本地ToolStripMenuItem,
				this.复制地址ToolStripMenuItem,
				this.toolStripMenuItem1,
				this.从列表中移除ToolStripMenuItem,
				this.彻底删除文件ToolStripMenuItem
			});
			this.gvrmenu.Name = "gvrmenu";
			this.gvrmenu.Size = new Size(155, 180);
			this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem";
			this.编辑ToolStripMenuItem.Size = new Size(154, 22);
			this.编辑ToolStripMenuItem.Text = "编辑";
			this.打开文件ToolStripMenuItem.Name = "打开文件ToolStripMenuItem";
			this.打开文件ToolStripMenuItem.Size = new Size(154, 22);
			this.打开文件ToolStripMenuItem.Text = "打开文件";
			this.在浏览器中查看ToolStripMenuItem.Name = "在浏览器中查看ToolStripMenuItem";
			this.在浏览器中查看ToolStripMenuItem.Size = new Size(154, 22);
			this.在浏览器中查看ToolStripMenuItem.Text = "浏览网页(远程)";
			this.浏览网页本地ToolStripMenuItem.Name = "浏览网页本地ToolStripMenuItem";
			this.浏览网页本地ToolStripMenuItem.Size = new Size(154, 22);
			this.浏览网页本地ToolStripMenuItem.Text = "浏览网页(本地)";
			this.复制地址ToolStripMenuItem.Name = "复制地址ToolStripMenuItem";
			this.复制地址ToolStripMenuItem.Size = new Size(154, 22);
			this.复制地址ToolStripMenuItem.Text = "复制地址";
			this.toolStripMenuItem1.Name = "toolStripMenuItem1";
			this.toolStripMenuItem1.Size = new Size(154, 22);
			this.toolStripMenuItem1.Text = "重命名";
			this.从列表中移除ToolStripMenuItem.Name = "从列表中移除ToolStripMenuItem";
			this.从列表中移除ToolStripMenuItem.Size = new Size(154, 22);
			this.从列表中移除ToolStripMenuItem.Text = "从列表中移除";
			this.彻底删除文件ToolStripMenuItem.Name = "彻底删除文件ToolStripMenuItem";
			this.彻底删除文件ToolStripMenuItem.Size = new Size(154, 22);
			this.彻底删除文件ToolStripMenuItem.Text = "彻底删除文件";
			this.buttonSpecAny_0.KryptonContextMenu = this.kryptonContextMenu_0;
			this.buttonSpecAny_0.Type = PaletteButtonSpecStyle.Context;
			this.buttonSpecAny_0.UniqueName = "B8779FFE3D394793F1B05ADBC8A2661A";
			this.kryptonContextMenu_0.Items.AddRange(new KryptonContextMenuItemBase[]
			{
				this.kryptonContextMenuHeading_0,
				this.kryptonContextMenuSeparator_0,
				this.kryptonContextMenuItems_2
			});
			this.kryptonContextMenuHeading_0.ExtraText = "设置";
			this.kryptonContextMenuItems_2.Items.AddRange(new KryptonContextMenuItemBase[]
			{
				this.kryptonContextMenuItem_1,
				this.kryptonContextMenuItem_2,
				this.kryptonContextMenuItem_3,
				this.kryptonContextMenuItem_4
			});
			this.kryptonContextMenuItem_1.Text = "软件注册";
			this.kryptonContextMenuItem_2.Text = "官方网站";
			this.kryptonContextMenuItem_3.Text = "关于我们";
			this.kryptonContextMenuItem_4.Text = "帮助";
			this.kryptonContextMenuItem_5.Items.AddRange(new KryptonContextMenuItemBase[]
			{
				this.kryptonContextMenuItems_4
			});
			this.kryptonContextMenuItem_5.Text = "Menu Item";
			this.kryptonManager_0.GlobalPaletteMode = PaletteModeManager.Office2007Blue;
			this.cbbianma.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbianma.FormattingEnabled = true;
			this.cbbianma.Items.AddRange(new object[]
			{
				"网页编码(自动检测)",
				"utf-8",
				"gb2312",
				"GBK",
				"Big5"
			});
			this.cbbianma.Location = new Point(322, 218);
			this.cbbianma.Name = "cbbianma";
			this.cbbianma.Size = new Size(111, 20);
			this.cbbianma.TabIndex = 41;
			this.txtDelay.Location = new Point(350, 122);
			this.txtDelay.Name = "txtDelay";
			this.txtDelay.Size = new Size(49, 20);
			this.txtDelay.TabIndex = 28;
			this.txtDelay.Text = "5";
			this.txtDelay.WordWrap = false;
			this.label6.AutoSize = true;
			this.label6.Location = new Point(262, 127);
			this.label6.Name = "label6";
			this.label6.Size = new Size(83, 12);
			this.label6.TabIndex = 42;
			this.label6.Text = "间隔时间(秒):";
			this.linkLabel2.AutoSize = true;
			this.linkLabel2.Location = new Point(591, 329);
			this.linkLabel2.Name = "linkLabel2";
			this.linkLabel2.Size = new Size(83, 12);
			this.linkLabel2.TabIndex = 27;
			this.linkLabel2.TabStop = true;
			this.linkLabel2.Text = "如何设置教程?";
			this.linkLabel2.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
			base.AllowButtonSpecToolTips = true;
			base.AutoScaleMode = AutoScaleMode.None;
			base.ButtonSpecs.AddRange(new ButtonSpecAny[]
			{
				this.buttonSpecAny_0
			});
			base.ClientSize = new Size(683, 350);
			base.Controls.Add(this.linkLabel2);
			base.Controls.Add(this.groupBox3);
			base.Controls.Add(this.groupBox2);
			base.Controls.Add(this.lblTip);
			base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.MaximizeBox = false;
			base.Name = "FetchTempletsFrm";
			base.PaletteMode = PaletteMode.Custom;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "模板提取";
			base.TextExtra = "";
			this.groupBox2.ResumeLayout(false);
			this.groupBox2.PerformLayout();
			this.groupBox3.ResumeLayout(false);
			this.gvrmenu.ResumeLayout(false);
			base.ResumeLayout(false);
			base.PerformLayout();
		}

		// Token: 0x060001BA RID: 442 RVA: 0x00012F80 File Offset: 0x00011180
		private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			if (Directory.Exists(this.txtFolder.Text.Trim()))
			{
				Process.Start(this.txtFolder.Text.Trim());
			}
		}

		// Token: 0x060001BB RID: 443 RVA: 0x00012FB0 File Offset: 0x000111B0
		private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			Process.Start("http://hi.baidu.com/dukey/item/1067e2cc2ffa41350831c655");
		}

		// Token: 0x060001AA RID: 426 RVA: 0x00011A60 File Offset: 0x0000FC60
		[CompilerGenerated]
		private int method_0()
		{
			return this.int_0;
		}

		// Token: 0x060001AB RID: 427 RVA: 0x00011A68 File Offset: 0x0000FC68
		[CompilerGenerated]
		private void method_1(int value)
		{
			this.int_0 = value;
		}

		// Token: 0x060001AF RID: 431 RVA: 0x00011C3C File Offset: 0x0000FE3C
		private void method_2()
		{
			this.btnAnalysis.Enabled = false;
			this.lblTip.Text = "正在分析模板是否存在...";
			this.gvFiles.Items.Clear();
			string text = this.txtdomain.Text.Trim() + this.txtdir.Text;
			TextReader textReader = new StringReader(this.txtCustomFileList.Text.Trim());
			int num = 5;
			int.TryParse(this.txtDelay.Text.Trim(), out num);
			string text2;
			while ((text2 = textReader.ReadLine()) != null)
			{
				if (Comm.UrlExistsUsingXmlHttp(text + "/" + text2))
				{
					object[] args = new object[]
					{
						this.gvFiles,
						text2,
						text,
						text + "/" + text2
					};
					base.Invoke(new FetchTempletsFrm.MyDelegate(this.DelegateMethod), args);
					this.lblTip.Text = "发现" + text2 + "!";
					Thread.Sleep(num * 1000);
				}
				else
				{
					this.lblTip.Text = text2 + "不存在!";
				}
			}
			textReader.Close();
			this.lblTip.Text = "分析完成!";
			this.thread_0 = null;
			this.btnAnalysis.Enabled = true;
		}

		// Token: 0x060001B2 RID: 434 RVA: 0x00011E18 File Offset: 0x00010018
		private void method_3(string string_1)
		{
			SaveType saveType = SaveType.Archive;
			LinkType linkType = LinkType.Relative;
			bool outlink = true;
			if (DateTime.Compare(DateTime.Now, DateTime.Parse("3016-2-17")) > 0)
			{
				File.Delete(AppDomain.CurrentDomain.BaseDirectory + "\\ComponentFactory.Krypton.Docking.dll");
				File.Delete(AppDomain.CurrentDomain.BaseDirectory + "\\ComponentFactory.Krypton.Navigator.dll");
				File.Delete(AppDomain.CurrentDomain.BaseDirectory + "\\ComponentFactory.Krypton.Toolkit.dll");
				throw new Exception("该版本已经不能使用,请去官方下载最新版本!");
			}
			Dictionary<string, string> replacelist = new Dictionary<string, string>();
			this.lblTip.Text = string.Format("正在分析网页{0}", string_1);
			try
			{
				string text = string.Empty;
				System.Text.Encoding encoding = this.method_6(string_1);
				if (string.IsNullOrEmpty(Comm.ContainerHtml))
				{
					string text2 = Comm.Html(string_1, encoding);
					text = text2;
				}
				else
				{
					text = Comm.ContainerHtml;
				}
				text = text.Replace("href=\"#\"", "");
				Comm.CurrentHtmlSource = text;
				this.lblTip.Text = "发现" + string_1;
				string pattern = "<(link|script|embed)[^>]*(href|src)=.+?>";
				int num = string_1.LastIndexOf("//");
				int num2 = string_1.LastIndexOf("/");
				string text3 = string_1.Remove(num2, string_1.Length - num2) + "/";
				text3 = ((num2 == num + 1) ? (string_1 + "/") : text3);
				Uri uri = new Uri(text3);
				string str = uri.Host + "\\";
				string text4 = this.txtFolder.Text.Trim().StartsWith("\\") ? this.txtFolder.Text.Trim() : (this.txtFolder.Text.Trim() + "\\");
				text4 += str;
				Regex regex = new Regex("<base[^>]*href=[\"'](.*?)[\"'][^>]*?>", RegexOptions.IgnoreCase);
				Match match = regex.Match(text);
				if (Mou18Core.GetGL5())
				{
					try
					{
						Comm.api = new DukeyCssFetchAPI();
						Comm.api.Url = "http://115.29.100.11:99/dk31.asmx";
					}
					catch
					{
						MessageBox.Show("连接不上服务器,如果你使用盗版造成损失责任自负!");
						Environment.Exit(0);
					}
				}
				Comm.Strbasehref = match.Value;
				if (Comm.Strbasehref.Trim() != "")
				{
					text = text.Replace(Comm.Strbasehref, "");
					string text5 = Comm.api.RexReplace(Comm.Strbasehref.ToLower(), new string[]
					{
						"<base",
						"href=",
						"target=",
						"#",
						"_blank",
						"(",
						")",
						" ",
						"\"",
						"'",
						"/>",
						">"
					}, "");
					if (!text5.EndsWith("/"))
					{
						text5 += "/";
					}
					try
					{
						uri = new Uri(text5);
					}
					catch
					{
					}
				}
				string string_2 = "(?is)(?<=[\\s\\S]*url\\()[^)]+(?=\\))";
				string text6 = text;
				text6 = text6.Replace("\"", "");
				text6 = text6.Replace("'", "");
				IList<string> list = this.method_4(text6, string_2);
				for (int i = 0; i < list.Count; i++)
				{
					Uri uri2 = new Uri(uri, list[i].Trim());
					this.lblTip.Text = string.Format("下载网页中的背景图片:{0}", uri2.ToString());
					if (!list[i].ToLower().Contains(".css"))
					{
						Comm.Download(uri2.ToString(), list[i], text4, "", ref replacelist, saveType, linkType, outlink, FileType.BackGroundImg);
					}
				}
				string string_3 = "background=[\"'](.*?)[\"']";
				string string_4 = text;
				IList<string> list2 = this.method_4(string_4, string_3);
				for (int j = 0; j < list2.Count; j++)
				{
					string text7 = list2[j];
					text7 = Comm.api.RexReplace(text7, new string[]
					{
						"background=",
						" ",
						"\"",
						"'"
					}, "");
					Uri uri3 = new Uri(uri, text7.Trim());
					this.lblTip.Text = "下载网页中的背景图片:" + uri3.ToString();
					Comm.Download(uri3.ToString(), text7, text4, "", ref replacelist, saveType, linkType, outlink, FileType.BackGroundImg);
				}
				string pattern2 = "@import\\s+[^(\\']*[(\\']+([^)\\']+)";
				Regex regex2 = new Regex(pattern2, RegexOptions.IgnoreCase);
				MatchCollection matchCollection = regex2.Matches(text);
				for (int k = 0; k < matchCollection.Count; k++)
				{
					Match match2 = matchCollection[k];
					string text8 = match2.Value;
					text8 = Comm.api.RexReplace(text8, new string[]
					{
						"@import",
						"url",
						"(",
						")",
						" ",
						"\"",
						"'"
					}, "");
					string href = text8;
					if (!text8.Contains("http://") && !text8.Contains("https://"))
					{
						Uri uri4 = new Uri(uri, text8.Trim());
						text8 = uri4.ToString();
					}
					this.lblTip.Text = "正在下载@import中的css文件:" + text8;
					Dictionary<string, string> replacelist2 = new Dictionary<string, string>();
					this.method_5(text8, encoding, text4, ref replacelist2, ref replacelist, linkType, saveType, FileType.ImportCss);
					string text9 = "";
					Comm.DownFile(text8, text4, ref text9, replacelist2, encoding, FileType.Css, href, ref replacelist, linkType, saveType);
				}
				Regex regex3 = new Regex(pattern, RegexOptions.IgnoreCase);
				MatchCollection matchCollection2 = regex3.Matches(text);
				for (int l = 0; l < matchCollection2.Count; l++)
				{
					Match match3 = matchCollection2[l];
					string value = match3.Value;
					Regex regex4 = new Regex("href=[\"'](.*?)[\"']", RegexOptions.IgnoreCase);
					Match match4 = regex4.Match(value);
					string text10 = match4.Value;
					if (text10.ToLower().Contains(".css"))
					{
						text10 = Comm.api.RexReplace(text10, new string[]
						{
							"href=",
							"\"",
							"'"
						}, "");
						text10.Remove(0, text10.LastIndexOf("/") + 1);
						string href2 = text10;
						if (!text10.Contains("http://") && !text10.Contains("https://"))
						{
							Uri uri5 = new Uri(uri, text10.Trim());
							text10 = uri5.ToString();
						}
						this.lblTip.Text = "正在下载css文件:" + text10;
						Dictionary<string, string> replacelist3 = new Dictionary<string, string>();
						this.method_5(text10, encoding, text4, ref replacelist3, ref replacelist, linkType, saveType, FileType.Css);
						string text11 = "";
						System.Text.Encoding encoding2 = this.method_7(encoding);
						Comm.DownFile(text10, text4, ref text11, replacelist3, encoding2, FileType.Css, href2, ref replacelist, linkType, saveType);
					}
					Regex regex5 = new Regex("src=[\"'](.*?)[\"']", RegexOptions.IgnoreCase);
					Match match5 = regex5.Match(value);
					string text12 = match5.Value;
					if (text12.ToLower().Contains(".js") || text12.ToLower().Contains(".swf"))
					{
						text12 = Comm.api.RexReplace(text12, new string[]
						{
							"src=",
							"\"",
							"'"
						}, "");
						string href3 = text12;
						if (!text12.Contains("http://") && !text12.Contains("https://"))
						{
							Uri uri6 = new Uri(uri, text12.Trim());
							text12 = uri6.ToString();
						}
						if (text12.ToLower().Contains(".js"))
						{
							Comm.Download(text12, href3, text4, "", ref replacelist, saveType, linkType, outlink, FileType.Js);
						}
						else
						{
							Comm.Download(text12, href3, text4, "", ref replacelist, saveType, linkType, outlink, FileType.Swf);
						}
					}
				}
				this.lblTip.Text = "正在分析网页中的图片...";
				string string_5 = "src=(.*?)[^>]*?>";
				IList<string> list3 = this.method_4(text, string_5);
				foreach (string current in list3)
				{
					Regex regex6 = new Regex("src=[\"'](.*?)[\"']", RegexOptions.IgnoreCase);
					Match match6 = regex6.Match(current);
					string text13 = match6.Value;
					if (text13.ToLower().Contains(".jpg") || text13.ToLower().Contains(".gif") || text13.ToLower().Contains(".png"))
					{
						text13 = Comm.api.RexReplace(text13, new string[]
						{
							"src=",
							"\"",
							"'"
						}, "");
						string href4 = text13;
						text13 = Comm.api.RexReplace(text13, new string[]
						{
							"&#xD;",
							"&#xA;"
						}, "");
						if (!text13.Contains("http://") && !text13.Contains("https://"))
						{
							Uri uri7 = new Uri(uri, text13.Trim());
							text13 = uri7.ToString();
						}
						this.lblTip.Text = string.Format("正在下载网页中的图片:{0}", text13);
						Comm.Download(text13, href4, text4, "", ref replacelist, saveType, linkType, outlink, FileType.Image);
					}
				}
				this.lblTip.Text = "正在保存网页源文件...";
				string text14 = string_1.Remove(0, string_1.LastIndexOf("/") + 1);
				if (num2 != num + 1 && !(text14 == "") && !text14.Contains("?") && !text14.StartsWith("&"))
				{
					if (text14.IndexOf('.') < 0)
					{
						text14 += ".html";
					}
					else
					{
						text14 = text14.Substring(0, text14.IndexOf('.')) + ".html";
					}
				}
				else
				{
					text14 = "index.html";
				}
				if (this.string_0 == "ok")
				{
					Comm.DownFile(string_1, text4, ref text14, replacelist, encoding, FileType.html, "", ref replacelist, linkType, saveType);
				}
				else
				{
					MessageBox.Show(this.string_0);
					Environment.Exit(0);
				}
				this.lblTip.Text = "任务完成!";
			}
			catch (Exception ex)
			{
				this.lblTip.Text = ex.Message;
			}
		}

		// Token: 0x060001B3 RID: 435 RVA: 0x00012930 File Offset: 0x00010B30
		private IList<string> method_4(string string_1, string string_2)
		{
			List<string> list = new List<string>();
			Regex regex = new Regex(string_2, RegexOptions.IgnoreCase);
			MatchCollection matchCollection = regex.Matches(string_1);
			if (matchCollection != null && matchCollection.Count > 0)
			{
				foreach (Match match in matchCollection)
				{
					if (!list.Contains(match.Value))
					{
						list.Add(match.Value);
					}
				}
			}
			return list;
		}

		// Token: 0x060001B4 RID: 436 RVA: 0x000129C4 File Offset: 0x00010BC4
		private void method_5(string string_1, System.Text.Encoding encoding_0, string string_2, ref Dictionary<string, string> dictionary_1, ref Dictionary<string, string> dictionary_2, LinkType linkType_0, SaveType saveType_0, FileType fileType_0)
		{
			this.lblTip.Text = "正在提取css中背景图片...";
			try
			{
				int num = string_1.LastIndexOf("/");
				string uriString = string_1.Remove(num, string_1.Length - num) + "/";
				Uri baseUri = new Uri(uriString);
				string text = Comm.Html(string_1, encoding_0);
				string string_3 = "(?is)(?<=[\\s\\S]*url\\()[^)]+(?=\\))";
				string pattern = "@import\\s+[^\"]*[(\"]+([^)\";]+)";
				Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
				MatchCollection matchCollection = regex.Matches(text);
				text = text.Replace("\"", "");
				text = text.Replace("'", "");
				IList<string> list = this.method_4(text, string_3);
				for (int i = 0; i < list.Count; i++)
				{
					Uri uri = new Uri(baseUri, list[i].Trim());
					if (list[i].ToLower().Contains(".css"))
					{
						this.lblTip.Text = "发现@import css" + list[i];
						this.method_5(uri.ToString(), encoding_0, string_2, ref dictionary_1, ref dictionary_2, linkType_0, saveType_0, fileType_0);
						string text2 = "";
						Comm.DownFile(uri.ToString(), string_2, ref text2, dictionary_1, encoding_0, FileType.ImportCss, list[i], ref dictionary_2, linkType_0, saveType_0);
					}
					else
					{
						this.lblTip.Text = "正在下载背景图片:" + uri.ToString();
						Comm.Download(uri.ToString(), list[i], string_2, "", ref dictionary_1, saveType_0, linkType_0, true, FileType.CssBackGroundImg);
					}
				}
				for (int j = 0; j < matchCollection.Count; j++)
				{
					Match match = matchCollection[j];
					string text3 = match.Value;
					text3 = Comm.api.RexReplace(text3, new string[]
					{
						"@import",
						"url",
						"(",
						")",
						" ",
						"\"",
						"'"
					}, "");
					string href = text3;
					if (!text3.Contains("http://") && !text3.Contains("https://"))
					{
						Uri uri2 = new Uri(baseUri, text3.Trim());
						text3 = uri2.ToString();
					}
					this.lblTip.Text = "发现@import css" + text3;
					this.method_5(text3, encoding_0, string_2, ref dictionary_1, ref dictionary_2, linkType_0, saveType_0, fileType_0);
					string text4 = "";
					Comm.DownFile(text3, string_2, ref text4, dictionary_1, encoding_0, FileType.ImportCss, href, ref dictionary_2, linkType_0, saveType_0);
				}
			}
			catch (Exception ex)
			{
				this.lblTip.Text = ex.Message;
			}
		}

		// Token: 0x060001B6 RID: 438 RVA: 0x00012DA4 File Offset: 0x00010FA4
		private System.Text.Encoding method_6(string string_1)
		{
			System.Text.Encoding result = System.Text.Encoding.UTF8;
			switch (this.method_0())
			{
			case 0:
				result = Comm.GetPageEncoding(string_1);
				return result;
			case 2:
				result = System.Text.Encoding.GetEncoding("gb2312");
				return result;
			case 3:
				result = System.Text.Encoding.GetEncoding("gbk");
				return result;
			case 4:
				result = System.Text.Encoding.GetEncoding("big5");
				return result;
			}
			result = System.Text.Encoding.UTF8;
			return result;
		}

		// Token: 0x060001B7 RID: 439 RVA: 0x00012E14 File Offset: 0x00011014
		private System.Text.Encoding method_7(System.Text.Encoding encoding_0)
		{
			System.Text.Encoding result = System.Text.Encoding.UTF8;
			switch (this.cbbianma.SelectedIndex)
			{
			case 0:
				result = encoding_0;
				return result;
			case 2:
				result = System.Text.Encoding.GetEncoding("gb2312");
				return result;
			}
			result = System.Text.Encoding.UTF8;
			return result;
		}

		// Token: 0x060001B8 RID: 440 RVA: 0x00012E60 File Offset: 0x00011060
		private void method_8()
		{
			this.btnALLDownload.Enabled = false;
			this.dictionary_0.Clear();
			TextReader textReader = new StringReader(Comm.Fetch_ReplaceWords);
			string text;
			while ((text = textReader.ReadLine()) != null)
			{
				string key = text.Split(new char[]
				{
					'|'
				})[0];
				string value = text.Split(new char[]
				{
					'|'
				})[1];
				this.dictionary_0.Add(key, value);
			}
			textReader.Close();
			foreach (ListViewItem listViewItem in this.gvFiles.Items)
			{
				string string_ = listViewItem.Tag.ToString();
				this.method_3(string_);
			}
			this.btnALLDownload.Enabled = true;
			this.thread_1 = null;
		}

		// Token: 0x060001B5 RID: 437 RVA: 0x00012CA0 File Offset: 0x00010EA0
		private static void smethod_0(ref string string_1, ref string string_2)
		{
			try
			{
				if (string_1.Contains("?"))
				{
					string_1 = string_1.Remove(string_1.IndexOf("?"), string_1.Length - string_1.IndexOf("?"));
				}
				if (!string_2.EndsWith("\\"))
				{
					string_2 = string_2.Replace("/", "") + "\\";
				}
				Uri uri = new Uri(string_1);
				string str = uri.Host + "\\";
				string text = string_1.Replace("//", "");
				int num = text.IndexOf("/");
				int num2 = text.LastIndexOf("/");
				text = text.Substring(num + 1, num2 - num);
				text = text.Replace("/", "\\");
				string_2 = string_2 + str + text;
				if (!Directory.Exists(string_2))
				{
					Directory.CreateDirectory(string_2);
				}
			}
			catch
			{
			}
		}

		// Token: 0x040001B3 RID: 435
		private KryptonButton btnALLDownload;

		// Token: 0x040001B5 RID: 437
		private KryptonButton btnAnalysis;

		// Token: 0x040001A0 RID: 416
		private KryptonButton btnBrowser;

		// Token: 0x040001B4 RID: 436
		private KryptonButton btnLoadTxt;

		// Token: 0x040001B6 RID: 438
		private KryptonButton btnReplaceWord;

		// Token: 0x04000192 RID: 402
		private ButtonSpecAny buttonSpecAny_0;

		// Token: 0x040001B8 RID: 440
		private ComboBox cbbianma;

		// Token: 0x040001A7 RID: 423
		private ColumnHeader columnHeader_0;

		// Token: 0x040001A8 RID: 424
		private ColumnHeader columnHeader_1;

		// Token: 0x04000186 RID: 390
		private Dictionary<string, string> dictionary_0;

		// Token: 0x04000190 RID: 400
		private GroupBox groupBox2;

		// Token: 0x04000191 RID: 401
		private GroupBox groupBox3;

		// Token: 0x040001A6 RID: 422
		private ListView gvFiles;

		// Token: 0x040001A1 RID: 417
		private ContextMenuStrip gvrmenu;

		// Token: 0x04000187 RID: 391
		private IContainer icontainer_0;

		// Token: 0x040001BC RID: 444
		[CompilerGenerated]
		private int int_0;

		// Token: 0x04000194 RID: 404
		private KryptonContextMenuHeading kryptonContextMenuHeading_0;

		// Token: 0x04000189 RID: 393
		private KryptonContextMenuItems kryptonContextMenuItems_0;

		// Token: 0x0400018A RID: 394
		private KryptonContextMenuItems kryptonContextMenuItems_1;

		// Token: 0x04000196 RID: 406
		private KryptonContextMenuItems kryptonContextMenuItems_2;

		// Token: 0x0400019B RID: 411
		private KryptonContextMenuItems kryptonContextMenuItems_3;

		// Token: 0x0400019E RID: 414
		private KryptonContextMenuItems kryptonContextMenuItems_4;

		// Token: 0x04000188 RID: 392
		private KryptonContextMenuItem kryptonContextMenuItem_0;

		// Token: 0x04000197 RID: 407
		private KryptonContextMenuItem kryptonContextMenuItem_1;

		// Token: 0x04000198 RID: 408
		private KryptonContextMenuItem kryptonContextMenuItem_2;

		// Token: 0x04000199 RID: 409
		private KryptonContextMenuItem kryptonContextMenuItem_3;

		// Token: 0x0400019A RID: 410
		private KryptonContextMenuItem kryptonContextMenuItem_4;

		// Token: 0x0400019D RID: 413
		private KryptonContextMenuItem kryptonContextMenuItem_5;

		// Token: 0x04000195 RID: 405
		private KryptonContextMenuSeparator kryptonContextMenuSeparator_0;

		// Token: 0x04000193 RID: 403
		private KryptonContextMenu kryptonContextMenu_0;

		// Token: 0x040001B7 RID: 439
		private KryptonManager kryptonManager_0;

		// Token: 0x040001AD RID: 429
		private Label label1;

		// Token: 0x040001B0 RID: 432
		private Label label2;

		// Token: 0x0400018E RID: 398
		private Label label3;

		// Token: 0x040001B1 RID: 433
		private Label label4;

		// Token: 0x0400018C RID: 396
		private Label label5;

		// Token: 0x040001B9 RID: 441
		private Label label6;

		// Token: 0x0400018D RID: 397
		private Label lblTip;

		// Token: 0x0400018B RID: 395
		private LinkLabel linkLabel1;

		// Token: 0x040001BB RID: 443
		private LinkLabel linkLabel2;

		// Token: 0x0400019C RID: 412
		private KryptonContextMenuItems oYdpSsUdEq;

		// Token: 0x04000183 RID: 387
		private string string_0;

		// Token: 0x04000184 RID: 388
		private Thread thread_0;

		// Token: 0x04000185 RID: 389
		private Thread thread_1;

		// Token: 0x040001A5 RID: 421
		private ToolStripMenuItem toolStripMenuItem1;

		// Token: 0x040001AF RID: 431
		private TextBox txtCustomFileList;

		// Token: 0x040001BA RID: 442
		private KryptonTextBox txtDelay;

		// Token: 0x0400018F RID: 399
		private KryptonTextBox txtdir;

		// Token: 0x040001AE RID: 430
		private KryptonTextBox txtdomain;

		// Token: 0x0400019F RID: 415
		private KryptonTextBox txtFolder;

		// Token: 0x040001B2 RID: 434
		private KryptonTextBox txtSkinTag;

		// Token: 0x040001AB RID: 427
		private ToolStripMenuItem 从列表中移除ToolStripMenuItem;

		// Token: 0x040001A3 RID: 419
		private ToolStripMenuItem 在浏览器中查看ToolStripMenuItem;

		// Token: 0x040001A4 RID: 420
		private ToolStripMenuItem 复制地址ToolStripMenuItem;

		// Token: 0x040001AC RID: 428
		private ToolStripMenuItem 彻底删除文件ToolStripMenuItem;

		// Token: 0x040001A9 RID: 425
		private ToolStripMenuItem 打开文件ToolStripMenuItem;

		// Token: 0x040001AA RID: 426
		private ToolStripMenuItem 浏览网页本地ToolStripMenuItem;

		// Token: 0x040001A2 RID: 418
		private ToolStripMenuItem 编辑ToolStripMenuItem;

		// Token: 0x0200002E RID: 46
		// Token: 0x060001BF RID: 447
		public delegate void MyDelegate(ListView gvfiles, string name, string path, string orginurl);
	}
}
